﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Models;
using DAL;

namespace 公司CRM客户关系系统
{
    /// <summary>
    /// login 的摘要说明
    /// </summary>
    public class login : IHttpHandler,System.Web.SessionState.IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            string action = context.Request["action"];
            if(action == "login"){
                //用户名和密码
                string name = context.Request["UserLName"];

                string pwd = context.Request["UserLPWD"];
                
                V_Users u = UserDAL.Login(name,pwd);
                if (u != null)
                {
                    context.Session["user"] = u;
                    context.Response.Write("1");
                }
                else
                {
                    context.Response.Write("0");
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}